package game;

import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.KeyEvent;

class Menu extends Scene
{
	Background background;
	SelecaoMenu selecao;
	boolean spacePressionado = true;
	
	
	public Menu()
	{
		background = new Background(5,new Point(0,0), new Point(800,600));
		background.setImage(7);
		
		Point[] pos = new Point[3];
		for(int i = 0; i < 3; i++)
		{
			pos[i]  = new Point(460, 268 + (i * 84));
		}
		selecao = new SelecaoMenu(pos, new Point(69, 39), false);
		
		Audios.getInstance().Loop(7);
		
	}

	public void update()
	{
		
		this.selecao.update();
		
		if(Keyboard.getInstance().isKeyPressed(KeyEvent.VK_SPACE))
		{
			if(!spacePressionado)
			{
				switch (this.selecao.getIndexOpcao()) 
				{
					case 0:
						SceneManager.changeScene(10);
						break;
						
					case 1:
						SceneManager.changeScene(6);
						break;
						
					case 2:
						SceneManager.changeScene(7);
						break;
				}
			}
		}
		else
		{
			this.spacePressionado = false;
		}
	}

	public void draw(Graphics2D g2d)
	{
		background.draw(g2d);
		this.selecao.draw(g2d);
	}

	


}